import { Tooltip } from "antd";
export const TextEllipsis = ({
  text = "",
  ellipsis = false,
  lineClamp = 1,
}) => {
  return (
    <div className="text-ellipsis" style={{ width: "100%" }}>
      {!ellipsis ? (
        text
      ) : (
        <Tooltip title={text}>
          <div
            className={`text`}
            style={{
              overflow: "hidden",
              whiteSpace: lineClamp > 1 ? "normal" : "nowrap",
              textOverflow: "ellipsis",
              display: "-webkit-box",
              WebkitLineClamp: `${lineClamp}`,
              WebkitBoxOrient: "vertical",
              cursor: "pointer",
            }}
          >
            {text}
          </div>
        </Tooltip>
      )}
    </div>
  );
};

export default TextEllipsis;
